const app = getApp()
var that
Page({
  data: {
    name:null,  //客户姓名
    name_input:null,  
  },
  onLoad: function (options) { 
    that=this;
    this.setData({name:options.name});
  },
  onReady: function () {
  },
  onShow: function () {
  },
  onHide: function () {
  },
  NameInput:function(e){
    // console.log(e.detail.value);  //输入的文本框的值,每变动一次执行一次
    this.setData({ name: e.detail.value });
  },
  name_ok:function(){
    var n = that.data.name
    // console.log(n == null || n == undefined || n.length == 0 || n == "" || n == " ");
    if(n==null||n==undefined||n.length==0||n=="")
    {
       wx.showToast({
        title: '内容不能为空',
        image: '../../images/g.png',
        duration: 1000,
        mask: true
      })
    }else{
      app.update_person_msg("custom_nickname", this.data.name);
      app.globalData.userInfo.custom_nickname = this.data.name;
      wx.navigateBack({//返回上一级
        delta: 1
      })
    }
  },
  delete_put:function(){
    this.setData({ name:"" });
  }

})